{% extends "base.html" %}
{% block css %}

{% endblock %}
{% block content %}
<main class="app-content">
      <div class="app-title">
        <div>
          <h1><i class="fa fa-th-list"></i>&nbsp;Vulnerability Management</h1>
          <p></p>
        </div>
        <ul class="app-breadcrumb breadcrumb side">
          <li class="breadcrumb-item"><i class="fa fa-home fa-lg"></i></li>
          <li class="breadcrumb-item">Home</li>
          <li class="breadcrumb-item active"><a href="#">Vulnerability List</a></li>
        </ul>
      </div>
      <div class="row">
        <div class="col-md-12">
          <div class="tile">
            <div class="tile-body">
              <table class="table table-hover table-bordered" id="sampleTable">
                <thead>
                    <tr class="text-center">
                        <th>Host</th>
                        <th>Name</th>
                        <th>Type</th>
                        <th>Task</th>
                        <th>Date</th>
                        <th>Manage</th>
                    </tr>
                </thead>
                <tbody>
                {% for i in vul_data %}
                    <tr class="text-center">
                        <td>
                            <a role="button" href="http://{{ i['target'] }}" target="_blank" title="Result">
                                {{ i['target'] }}
                            </a>
                        </td>
                        <td>{{ i['plugin_name'] }}</td>
                        <td>{{ i['plugin_type'] }}</td>
                        <td>{{ i['task_name'] }}</td>
                        <td>{{ i['date'] }}</td>
                        <td class="text-center">
                            <a onclick="vul_result('{{ i['_id'] }}')"  role="button" data-target="#vulResult" data-toggle="modal" href="#" title="Result" >
                                <i class="ace-icon fa fa-file-archive-o bigger-130"></i>
                            </a>
                            &nbsp;
                            <a href="vulnerability?delete={{ i['_id'] }}" title="Delete" >
                                <i class="fa fa-trash-o"></i>
                            </a>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
              </table>
                <div class="modal" id="vulResult" >
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h5 class="modal-title">Vulnerability Info</h5>
                                <button class="close" type="button" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                            </div>
                            <div class="modal-body">
                                <div id='scan_target_list'>

                                </div>
                            </div>
                            <div class="modal-footer">
                                <button class="btn btn-primary" type="button" data-dismiss="modal">Close</button>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
          </div>
        </div>
      </div>
    </main>

{% endblock %}
{% block js %}
    <!-- Data table plugin-->
    <script type="text/javascript" src="static/js/plugins/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="static/js/plugins/dataTables.bootstrap.min.js"></script>
    <script src="static/js/plugins/sweetalert/sweetalert.min.js"></script>
    <script src="static/js/server/vulnerability.js"></script>
{% endblock %}